﻿using System;

namespace WPNextTools.NEventArgs
{
    public class CurrentItemChangingEventArgs : EventArgs
    {
        private bool cancelable;
        private bool cancel;
        private object newCurrentItem;

        public object NewCurrentItem
        {
            get
            {
                return this.newCurrentItem;
            }
        }

        public bool Cancelable
        {
            get
            {
                return this.cancelable;
            }
        }

        public bool Cancel
        {
            get
            {
                return this.cancel;
            }
            set
            {
                if (value && !this.cancelable)
                {
                    throw new InvalidOperationException("Event is not cancelable");
                }
                this.cancel = value;
            }
        }

        public CurrentItemChangingEventArgs(object newCurrent, bool cancelable)
        {
            this.newCurrentItem = newCurrent;
            this.cancelable = cancelable;
        }
    }
}
